package org.lixf.tomcat;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.Writer;

public class HelloServlet extends HttpServlet {
    private static final long serialVersionUID = 3600060857537422698L;
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // response.setCharacterEncoding("UTF-8");
        // response.setContentType("text/plain");
        int a = 1/0;
        try (Writer writer = response.getWriter()) {
            writer.write("Hello, Embedded Tomcat!");
            writer.flush();
        }
    }
}